package com.sinosoft.app.notice.biz.imp;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sinosoft.app.notice.biz.RuleNoticeBiz;
import com.sinosoft.app.notice.dao.RuleNoticeDao;
import com.sinosoft.app.notice.entity.RuleNotice;
import com.sinosoft.system.util.page.Pagenation;

@Service
@Transactional
public class RuleNoticeBizImp implements RuleNoticeBiz{

	private static Logger log = Logger.getLogger(RuleNoticeBizImp.class);
	
	@Autowired
	private RuleNoticeDao ruleNoticeDao;
	
	@Override
	public int insertRuleNotice(RuleNotice ruleNotice) {
		log.info("新增RuleNotice数据"+ruleNotice.toString());
		return ruleNoticeDao.insertRuleNotice(ruleNotice);
	}

	@Override
	public int updateRuleNotice(RuleNotice ruleNotice) {
		log.info("更新RuleNotice数据"+ruleNotice.toString());
		return ruleNoticeDao.updateRuleNotice(ruleNotice);
	}

	@Override
	public int deleteRuleNotice(int id) {
		log.info("删除RuleNotice数据 id="+id);
		return ruleNoticeDao.deleteRuleNotice(id);
	}

	@Override
	public RuleNotice selectRuleNotice(int id) {
		log.info("根据ID查询RuleNotice数据 id="+id);
		return ruleNoticeDao.selectRuleNotice(id);
	}

	@Override
	public RuleNotice selectRuleNotice(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询RuleNotice数据 ");
		return ruleNoticeDao.selectRuleNotice(queryKeys, queryValues);
	}

	@Override
	public int selectCountRuleNotice() {
		log.info("查询RuleNotice数据 总数量");
		return ruleNoticeDao.selectCountRuleNotice();
	}

	@Override
	public int selectCountRuleNotice(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询RuleNotice数据 总数量"+queryKeys.toString());
		return ruleNoticeDao.selectCountRuleNotice(queryKeys, queryValues);
	}

	@Override
	public List<RuleNotice> selectLimitRuleNotice(int start, int size) {
		log.info("查询RuleNotice数据 limit数量:start="+start+",size="+size);
		return ruleNoticeDao.selectLimitRuleNotice(start, size);
	}

	@Override
	public List<RuleNotice> selectLimitRuleNotice(List<String> queryKeys,List<Object> queryValues,int start, int size) {
		log.info("条件查询RuleNotice数据数量");
		return ruleNoticeDao.selectLimitRuleNotice(queryKeys, queryValues, start,  size);
	}

	@Override
	public List<RuleNotice> selectAllRuleNotice() {
		log.info("查询所有RuleNotice数据");
		return ruleNoticeDao.selectAllRuleNotice();
	}

	@Override
	public List<RuleNotice> selectAllRuleNotice(List<String> queryKeys,List<Object> queryValues) {
		log.info("条件查询所有RuleNotice数据");
		return ruleNoticeDao.selectAllRuleNotice(queryKeys, queryValues);
	}

	@Override
	public Pagenation selectPageRuleNotice(Pagenation page) {
		log.info("分页查询所有RuleNotice数据");
		int start =	page.getStartRow();
		int size = page.getPageSize();
		List<RuleNotice> rows = ruleNoticeDao.selectLimitRuleNotice(page.getQueryKeys(), page.getQueryValues(),start,size);
		int total = ruleNoticeDao.selectCountRuleNotice(page.getQueryKeys(), page.getQueryValues());
		page.setTotal(total);
		page.setRows(rows);
		return page;
	}

	public RuleNoticeDao getRuleNoticeDao() {
		return ruleNoticeDao;
	}

	public void setRuleNoticeDao(RuleNoticeDao ruleNoticeDao) {
		this.ruleNoticeDao = ruleNoticeDao;
	}

}
